﻿using System.Collections.Generic;
using BlueDot.Data.Core;

namespace CreateDatabaseFromEntities.Data.Entities
{
    public class Category : Entity
    {
        #region Fields

        public const string CategoryIDColumnName = "CategoryID";
        public const string CodeColumnName = "Code";
        public const string PostsColumnName = "Posts";

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the catetory ID.
        /// IsUniqueKey: Defines this property as the UniqueKey (Primary Key)
        /// IsGenerated: Defines this property is gernerated by the database. Since
        /// the dataType is an int the DB provider will create the field as an Identity field
        /// </summary>
        /// <value>The user ID.</value>
        [Property(IsUniqueKey = true, IsGenerated = true)]
        public int CategoryID { get; set; }

        /// <summary>
        /// Gets or sets the code.
        /// </summary>
        /// <value>The title.</value>
        [Property(MaxLength = 20, IsRequired = true)]
        public string Code { get; set; }

        /// <summary>
        /// Gets or sets the posts.
        /// </summary>
        /// <value>The posts.</value>
        [Relationship(RelationshipType = RelationShipTypes.ManyToMany)]
        public List<Post> Posts { get; set; }

        #endregion
    }
}